# F. Процессоры-лжецы

n, m = list(map(int, input().split()))
if m < 8 and n < m:
    n, m = m, n
    
dnl = {}

def check_end(s1, s2):
    
    # нижние углы не могут быть пустыми
    if s1[0] == '0' and s2[:2] == '00':
        return True
    if s1[-1] == '0' and s2[-2:] == '00':
        return True               
    if s1[0] == '1' and s2[:2] == '01':
        return True
    if s1[-1] == '1' and s2[-2:] == '10':
        return True
    for j in range(n-2):
        # ноль в последней строке в окружении нулей
        if s2[j:j+3] == '000' and s1[j+1] == '0':
            return True
        # ноль в последней строке в окружении единиц
        if s2[j:j+3] == '101' and s1[j+1] == '1':
            return True
        
    return False

def calc(n, m):

    if n == 1:
        if m % 3 == 1:
            return m // 3 + 1
        return m
    
    if m == 1:
        if n % 3 == 1:
            return n // 3 + 1
        return n
    
    cnl = 0
    for i in range(1, 2 ** n):
        s = bin(2 ** n + i)[3:]
        if s[0] == '1':
            kl = 1
        else:
            kl = 0
        for j in range(n):
            if s[j] == '1':
                kl += 1
                if s[j] == s[j-1]:
                    break
        else:
            if kl < 3:
                cnl += 1
                dnl[s] = kl
                #print(cnl, s, kl)
            
    odp = {}
    for s1 in dnl.keys():
        for s2 in dnl.keys():
                        
            # верхние углы не могут быть пустыми
            if s2[0] == '0' and s1[:2] == '00':
                continue             
            if s2[-1] == '0' and s1[-2:] == '00':
                continue                              
            if s2[0] == '1' and s1[:2] == '01':
                continue             
            if s2[-1] == '1' and s1[-2:] == '10':
                continue
            for j in range(n):
                if s1[j] == '1' and s2[j] == '1':
                    break
                # ноль в первой строке в окружении нулей
                if j < n - 2 and s1[j:j+3] == '000' and s2[j+1] == '0':
                    break
                # ноль в первой строке в окружении единиц
                if j < n - 2 and s1[j:j+3] == '101' and s2[j+1] == '1':
                    break
            else:
                if m == 2 and check_end(s1, s2):
                    continue
                count = dnl[s1] + dnl[s2]
                odp[("00000",s1,s2)] = count
                #print("odp", s1, s2, count)

    if m == 2:
        nm = n * m
        for p in odp.keys():
            count = odp[p]
            if count < nm:
                nm = count
        return nm
    
    # cycle from 3 to M
    for step in range(3, m+1):
        ndp = {}
        for p in odp:         
            s0, s1, s2 = p
            for s3 in dnl.keys():
                count = odp[p] + dnl[s3]
                np = (s1, s2, s3)
                if np in ndp:
                    old_count = ndp[np]
                    if count >= old_count:
                        continue
                # ноль слева в окружении нулей
                if s3[0] == '0' and s2[:2] == '00' and s1[0] == '0':
                    continue
                # ноль справа в окружении нулей
                if s3[-1] == '0' and s2[-2:] == '00' and s1[-1] == '0':
                    continue
                # ноль слева в окружении единиц
                if s3[0] == '1' and s2[:2] == '01' and s1[0] == '1':
                    continue
                # ноль справа в окружении единиц
                if s3[-1] == '1' and s2[-2:] == '10' and s1[-1] == '1':
                    continue
                for j in range(n):
                    if s3[j] == '1' and s2[j] == '1':
                        break
                    # крест из нулей
                    if j < n - 2 and s2[j:j+3] == '000' and s1[j+1] == '0' and s3[j+1] == '0':
                        break
                    # крест из единиц с нулем внутри
                    if j < n - 2 and s2[j:j+3] == '101' and s1[j+1] == '1' and s3[j+1] == '1':
                        break
                else:
                    if step == m and check_end(s2, s3):
                        continue
                    ndp[(s1, s2, s3)] = count
                    
        #print("len ndp =", len(ndp))
        odp = ndp
        
    nm = n * m
    for p in odp.keys():
        count = odp[p]
        if count < nm:
            nm = count
    return nm

print(calc(n,m))
   
# empty string

